package zhishuang.wang.sansi.playlist.entry;

/**
 * @Author Zhishuang.Wang
 * @Date 2023/7/5 11:09
 * @Email 1406110602@qq.com
 */

import zhishuang.wang.sansi.tools.ReturnData;

public class Background {
    private Integer transparentFlag;
    private BaseColour backColour;
    private PictureBase backPicture;

    public Background() {
    }

    public ReturnData checkParam() {
        ReturnData rd = new ReturnData();
        rd.setCode(1);
        String errorMes = "";
        if (this.transparentFlag != null) {
            if (this.transparentFlag < 0 || this.transparentFlag > 1) {
                errorMes = errorMes + "透明标志 取值范围：0或1";
            }

            ReturnData checkRd = null;
            if (this.backColour != null) {
                checkRd = this.backColour.checkParam();
                if (checkRd.getCode() != 0) {
                    errorMes = errorMes + "背景颜色：" + checkRd.getMessage();
                }
            }

            if (this.backPicture != null) {
                checkRd = this.backPicture.checkParam();
                if (checkRd.getCode() != 0) {
                    errorMes = errorMes + "背景音频：" + checkRd.getMessage();
                }
            }
        }

        if (errorMes != null && errorMes.length() != 0) {
            rd.setMessage(errorMes);
        } else {
            rd.setCode(0);
        }

        return rd;
    }

    public BaseColour getBackColour() {
        return this.backColour;
    }

    public void setBackColour(BaseColour backColour) {
        this.backColour = backColour;
    }

    public PictureBase getBackPicture() {
        return this.backPicture;
    }

    public void setBackPicture(PictureBase backPicture) {
        this.backPicture = backPicture;
    }

    public Integer getTransparentFlag() {
        return this.transparentFlag;
    }

    public void setTransparentFlag(Integer transparentFlag) {
        this.transparentFlag = transparentFlag;
    }
}
